package com.eece496.Database;
import java.sql.*;

public class Connection {

	private static java.sql.Connection connection = null;
	
	public static void Connect()
	{
		String connectionString = "jdbc:mysql://localhost/groupassessments?user=bluebear&password=bluebeariscute89";
		try
        {
            // Ensure the SQL Server driver class is available.
            Class.forName("com.mysql.jdbc.Driver");

            // Establish the connection.
            connection = DriverManager.getConnection(connectionString);
        }
        // Exception handling
        catch (ClassNotFoundException cnfe)  
        {

            System.out.println("ClassNotFoundException " +
                               cnfe.getMessage());
        }
        catch (Exception e)
        {
            System.out.println("Exception " + e.getMessage());
            e.printStackTrace();
        }
	}
	
	//For Testing
	public static void main(String[] args) throws SQLException
	{
		Connect();		
	}
	
	public static void DeleteAll()
	{
		Student StudentDB = new Student();
		StudentDB.Setup(connection);
		try {
			StudentDB.DeleteAll();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
